package com.systop.service.UserServiceImpl;

import com.systop.mapper.CommentMapper;
import com.systop.pojo.Comment;
import com.systop.pojo.Goods;
import com.systop.service.CommentService;
import com.systop.unti.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentMapper commentMapper;
    //评论
    @Override
    public ResponseResult addComment(Comment comment) {
        Integer i = commentMapper.addComment(comment);
        return ResponseResult.ok(i);
    }
    //根据商品id查看评论
    @Override
    public List<Comment> selCommentByid(Integer comment_goods_id) {
        return commentMapper.selCommentByid(comment_goods_id);
    }
    //用户查看自己给商品的评论（根据用户id查询消息）
    @Override
    public List<Comment> selCommentByUserId(Integer comment_user_id) {
        return commentMapper.selCommentByUserId(comment_user_id);
    }

    @Override
    public List selCommentAndGoods(Integer comment_goods_id) {
        return commentMapper.selCommentAndGoods(comment_goods_id);
    }
}
